package iso 
{
	import com.greensock.events.LoaderEvent;
	import com.greensock.loading.LoaderMax;
	import com.greensock.loading.SWFLoader;
	import com.greensock.loading.XMLLoader;
	import flash.display.Sprite;
	import flash.display.StageScaleMode;
	import flash.events.MouseEvent;
	import flash.geom.Matrix;
	import flash.geom.Point;
	import flash.geom.Transform;
	import flash.geom.Vector3D;
	import flash.system.LoaderContext;
	import flash.utils.setTimeout;
	import iscript.gameFramework.IsoEngine.core.IsoScene;
	import iscript.gameFramework.IsoEngine.display.IsoGrid;
	import iscript.gameFramework.IsoEngine.util.IsoMath;
	import iscript.gameFramework.IsoEngine.util.IsoUtil;
	import iscript.uiFramework.components.toolButton.*;
	import iscript.uiFramework.UIFramework;
	import iso.isoLogic.isomain;
	import iso.tool.IsoToolPanel;
	public class isotest extends Sprite
	{
		
		public var loader:LoaderMax;
		
		public function isotest() 
		{			
			stage.scaleMode = StageScaleMode.NO_SCALE;
			LoaderMax.defaultContext = new LoaderContext(false, stage.loaderInfo.applicationDomain);
			loader = new LoaderMax();
			loader.append(new SWFLoader("UISKin.swf", {name: "UISKINSWF"}));
			loader.append(new XMLLoader("UIResourceSetting.xml", {name: "UISKINXML"}));
			loader.load()
			loader.addEventListener(LoaderEvent.COMPLETE, _initializeUI);			
		}
		
		private function _initializeUI(e:LoaderEvent):void 
		{
			var data:XML = XML(XMLLoader(loader.getLoader("UISKINXML")).content)
			var uiFramework:UIFramework = new UIFramework();
			uiFramework.initialize(stage, data);
			
			addChild(new isomain());
			addChild(new IsoToolPanel());
	 		
			
			/*
			var s:Sprite = Rect();
			
			var matrix:Matrix = new Matrix();
			    matrix.rotate(IsoMath.angTorad(45))
				matrix.scale(1, 0.5);
			
		 	s.transform.matrix = matrix;
			s.x = 100;
			s.y=100
			addChild(s)
			trace(Math.round(s.width),Math.round(s.height)) 
			
			var right:Sprite = Rect();
			matrix= new Matrix();
			matrix.b =  Math.tan(IsoMath.angTorad( -27));
			//matrix.c= Math.tan(IsoMath.angTorad(27))
			right.transform.matrix = matrix;
			right.x = 100;
			right.y = 100;
			addChild(right);
			trace(Math.round(right.width),Math.round(right.height)) 
			right.y -=(right.height-45)/2
		*/
		}
		
		
		
		private function Rect():Sprite {
		var s:Sprite = new Sprite();
		s.graphics.beginFill(0xFF00FF,0.5);
		s.graphics.drawRect(0,0,45,45);
		s.graphics.endFill();
		addChild(s);
		return s;
	   }
		
		
	}

}